﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PublicMethod
{
    public static class GetDict
    {

        private static List<Model.Basic_Dict_T> dictList;

        public static List<Model.Basic_Dict_T> DictList
        {
            get
            {
                if (dictList == null)
                {
                    string result = new OrderingOnlineWeChat.ZHHQService.Service1Client().GetBasicDict(0, GetYZM._YZM, 1);

                    JObject jb = JObject.Parse(result);
                    IList<JToken> jieguo = jb["rows"].Children().ToList();
                    dictList = ParseClass<Model.Basic_Dict_T>.JsonList(jieguo);
                    return dictList;
                }
                else
                {
                    return dictList;
                }
            }
        }

        public static List<Model.Basic_Dict_T> GetList(int ID)
        {
            List<Model.Basic_Dict_T> ls = new List<Model.Basic_Dict_T>();
            ls = DictList.FindAll(u => u.DictId == ID);
            return ls;
        }
    }
}